package com.icss.clothes.cotroller;

import com.icss.clothes.entity.Shop;
import com.icss.clothes.service.imp.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private ShopService shopService;
    @RequestMapping("/")
    public String toIndex(){
        return "index";
    }

    //用于获取特色产品的控制器方法
    @RequestMapping("/getSpecialProducts")
    @ResponseBody
    public List<Shop> getSpecialProducts(){
         List<Shop> specialShopList = shopService.findBycomment("特色");
          return specialShopList;
    }

    //用于获取最新上架、最高销量、最佳评分的控制器方法
    @RequestMapping("/getCommodityBySort")
    @ResponseBody
    public List<Shop> getCommodityBySort(int sortid){
          List<Shop> CommodityList = shopService.findCommodityBySort(sortid);
          return CommodityList;
    }

}
